import request from '@/utils/request'

export function login(username, password, role) {
  return request({
    url: `/auth/login`,
    method: 'post',
    data: {
      name: username,
      password: password
    }
  })
}

export function getInfo(token) {
  return request({
    url: `/auth/user/info`,
    method: 'get'
  })
}

/**
 * 获取信息
 * @param token
 * @returns {*}
 */
export function getUserInfo(token) {
  return request({
    url: `/api/user/curr_user`,
    method: 'get'
  })
}

/**
 * 修改基本信息
 * @param token
 * @returns {*}
 */
export function changeGetUserInfo(params) {
  return request({
    url: `/api/user`,
    method: 'put',
    data: params
  })
}

export function logout() {
  return request({
    url: `/auth/logout`,
    method: 'get'
  })
}

export function changePassword(params) {
  return request({
    url: `/api/user/password/reset`,
    method: 'put',
    data: params
  })
}

/**
 * 营业状态
 * @param token
 * @returns {*}
 */
export function business(params) {
  return request({
    url: `/api/brand/business`,
    method: 'put',
    data: params
  })
}
